abstract class Animal {
    public abstract void eat();
    public abstract void sleep();
}
class Cat extends Animal{
    @Override
    public void eat(){
        System.out.println("cat is eating fish");
    }
    @Override
    public void sleep(){
        System.out.println("cat is sleeping on the bed");
    }
}
class Dog extends Animal{
    @Override
    public void eat(){
        System.out.println("Dog is gnawing bone");
    }
    @Override
    public void sleep(){
        System.out.println("Dog is sleeping on the floor");
    }
}
class Raiser{
    public void feed(Animal animal){
        animal.eat();
        animal.sleep();
    }
}
public class Example5_6{
    public static void main(String[] args){
        Cat cat=new Cat();
        Dog dog=new Dog();
        Raiser mike=new Raiser();
        mike.feed(cat);//animal=cat cat上转型为animal    A a=new B();
        mike.feed(dog);//animal=dog dog上转型为animal
    }
}